# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=hexchat
pkgver=2.16.1
pkgrel=4
pkgdesc="Graphical IRC client based on XChat"
url="https://hexchat.github.io"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	dbus-glib-dev
	gtk+2.0-dev
	iso-codes-dev
	libnotify-dev
	libproxy-dev
	libsexy-dev
	libxml2-dev
	lua5.4-dev
	meson
	openssl-dev>3
	python3-dev
	py3-cffi
	"
subpackages="$pkgname-doc $pkgname-lang $pkgname-python:_python"
source="https://dl.hexchat.net/hexchat/hexchat-$pkgver.tar.xz
	force-meson-build-order.patch
	"
options="!check" # No test suite

build() {
	abuild-meson \
		-Dwith-perl=false \
		-Dwith-lua=lua5.4 \
		-Dwith-sysinfo=false \
		-Dwith-python=python3-embed \
		build_dir/
	meson compile -C build_dir/
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build_dir

	# not worth a -dev pkg
	rm -fr "$pkgdir"/usr/include
	rm -fr "$pkgdir"/usr/lib/pkgconfig
}

_python() {
	pkgdesc="Python plugin for hexchat"
	depends="$pkgname=$pkgver-r$pkgrel py3-cffi"
	amove usr/lib/hexchat/plugins/python.so
	amove usr/lib/hexchat/python
}

sha512sums="
9e6baa30ec8c3ce4fb56e2c82625da63295040eaf93a542aec8a4a18a6a3c95d69d1d4ffabc952bcdcd7b754afef234b348f296143991fafd0550342db95ce0e  hexchat-2.16.1.tar.xz
f579622330391fbce798bf9b0e5c1d07975a188b79f7160ab8c921b7df92b2d31444f30d6f62b7b08f7543a4ef40975ecf53705903374b73069bb369967491c5  force-meson-build-order.patch
"
